<!doctype html>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/modules/cms/front/include/taglib.jsp"%>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>山东林业扶贫项目</title>
  <meta name="description" content="山东林业扶贫项目">
  <meta name="keywords" content="index">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="${ctxStatic}/sdlyfp/i/favicon.png">
  <link rel="apple-touch-icon-precomposed" href="${ctxStatic}/sdlyfp/i/app-icon72x72@2x.png">
  <meta name="apple-mobile-web-app-title" content="Amaze UI" />
  <link rel="stylesheet" href="${ctxStatic}/sdlyfp/css/amazeui.min.css" />
  <link rel="stylesheet" href="${ctxStatic}/sdlyfp/css/admin.css">
  <link rel="stylesheet" href="${ctxStatic}/sdlyfp/css/app.css">
  <script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
  <link rel="stylesheet" href="${ctxStatic}/sweetalert/sweetalert.css">
  <script src="${ctxStatic}/sweetalert/sweetalert.min.js"></script>
  <script src="${ctxStatic}/sdlyfp/js/base.js"></script>
  
</head>

<body data-type="generalComponents">

	<!-- head -->
	<jsp:include page="head.jsp" flush="false"></jsp:include>
	
	<div class="tpl-page-container tpl-page-header-fixed">
	
	<!-- 菜单 -->
	<jsp:include page="menu.jsp" flush="false"></jsp:include>


        <div class="tpl-content-wrapper">
            <div class="tpl-content-page-title">
                护林员岗位扶贫
            </div>
            <ol class="am-breadcrumb">
                <li><a href="#" class="am-icon-home">首页</a></li> 
                <li class="am-active">护林员岗位</li>
            </ol>
            <div class="tpl-portlet-components">
                <div class="portlet-title">
                    <div class="caption font-green bold">
                        <span class="am-icon-code"></span> 项目列表
                        
                        <span id="tip" style="margin-left: 200px;display: none;">
							<img style="width: 35px;height: 35px;" src="${ctxStatic }/sdlyfp/img/loading.gif">
							<font color="red">正在导出，请耐心等待...</font>
						</span>
                        
                    </div>
                    <div class="tpl-portlet-input tpl-fz-ml">
                        <div class="portlet-input input-inline">
                            <div class="input-icon right">  
                            <a href="${ctx }/gt/gtPost/form?menuId=${gtPost.menuId }">
                            	<button type="button" class="am-btn am-btn-default am-btn-success"><span class="am-icon-plus"></span> 新增</button>
                            </a>
                           <!--  &nbsp;
                           	<a href="#" onclick="downLoad();">
                           	<button type="button" class="am-btn am-btn-default am-btn-secondary">
                           		导出excel</button>
                           	</a> -->
                            </div>
                        </div>
                    </div>


                </div>
                <div class="tpl-block">
                
                <form class="am-form" action="${ctx }/gt/gtPost" method="post">
                	<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
					<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
					<input id="areaCode" name="area.code" type="hidden" value="${gtPost.area.code }"/>
					
					<input type="hidden" id="menuId" name="menuId" value="${gtPost.menuId }"/>
					
                    <div class="am-g">
                        <div class="am-u-sm-12 am-u-md-3">
                            <div class="am-form-group">
                                  <select id="region" data-am-selected="{btnSize: 'sm'}" onchange="showSubArea(this,'county');">
                                  	<!-- 只有省级及以上账号时才展示请选择 -->
	                                  <c:if test="${fns:getUser().area.type lt 3}">
	                                  	<option value="null">---请选择---</option>
	                                  </c:if>
						              <c:forEach items="${regions }" var="region">
						              	<option value="${region.code }">${region.name }</option>
						              </c:forEach>
						            </select>
                            </div>
                        </div>
						<div class="am-u-sm-12 am-u-md-3">
                            <div class="am-form-group">
                                  <select id="county" data-am-selected="{btnSize: 'sm'}" onchange="showSubArea(this,'town');">
                                  	  <!-- 只有地市及以上账号时才展示请选择 -->
	                                  <c:if test="${fns:getUser().area.type lt 4}">
	                                  	  <option value="null">---请选择---</option>
	                                  </c:if>
						              <c:forEach items="${countys }" var="county">
						              	<option value="${county.code }">${county.name }</option>
						              </c:forEach>
						            </select>
                            </div>
                        </div>
                        <div class="am-u-sm-12 am-u-md-3">
                            <div class="am-form-group">
                                  <select id="town" data-am-selected="{btnSize: 'sm'}">
                                  	  <option value="null">---请选择---</option>
						              <c:forEach items="${towns }" var="town">
						              	<option value="${town.code }">${town.name }</option>
						              </c:forEach>
						            </select>
                            </div>
                        </div>
                        <div class="am-u-sm-12 am-u-md-3">
                            <div class="am-input-group am-input-group-sm">
                                <input type="text" name="name" value="${gtPost.name }" class="am-form-field">
                                <span class="am-input-group-btn">
					            <button class="am-btn  am-btn-default am-btn-success tpl-am-btn-success am-icon-search" type="button" onclick="doSubmit();"></button>
					          </span>
                            </div>
                        </div>
                    </div>
                    
                    </form>
                    
                    
                    <div class="am-g">
                        <div class="am-u-sm-12">
                                <table class="am-table am-table-striped am-table-hover table-main">
                                    <thead>
                                        <tr>
                                            <th class="table-title">所属乡镇</th>
                                            <th class="table-title">姓名</th>
                                            <th class="table-type">是否户主</th>
											<th class="table-type">身份证号</th>
											<th class="table-type">家庭住址</th>
											<!-- <th class="table-type">帮扶方式</th> -->
											<!-- <th class="table-type">帮扶金额</th>
											<th class="table-type">帮扶时间</th>  -->
											<th class="table-author am-hide-sm-only">经办人联系方式</th> 
                                            <th class="table-set">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    	<c:forEach items="${page.list }" var="post">
                                        <tr>
                                        	<td>${post.area.name }</td>
                                            <td>${post.name }</td>
                                            <td>${post.isHolder eq '1'?'是':'否'}</td>
                                            <td>${post.idcard }</td> 
                                            <td>${post.address }</td>
                                            <%-- <td>${postPeople.money }元</td>
                                            <td><fmt:formatDate value="${postPeople.moneyTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td> --%>
                                           	 <td>${post.createBy.mobile }</td>
                                            <td>  
                                            	<div class="am-btn-toolbar">
                                                    <div class="am-btn-group am-btn-group-xs">
                                                        <a class="am-btn am-btn-default am-btn-xs am-text-secondary" href="${ctx }/gt/gtPost/form?id=${post.id }&menuId=${gtPost.menuId }"><span class="am-icon-pencil-square-o"></span> 修改</a></a>
                                                        <button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only" type="button" onclick="del('${post.id }');"><span class="am-icon-trash-o"></span> 删除</button>
                                                    </div>
                                                </div>
                                            </td> 
                                       </tr>
                                       </c:forEach>
                                    </tbody>
                                </table>
                                <div class="am-cf">

                                    <div class="am-fr">
                                        ${page }
                                    </div>
                                </div>
                                <hr>
                        </div>

                    </div>
                </div>
                <div class="tpl-alert"></div>
            </div>


        </div>

    </div>

  <script src="${ctxStatic}/sdlyfp/js/jquery.min.js"></script>
  <script src="${ctxStatic}/sdlyfp/js/amazeui.min.js"></script>
  <script src="${ctxStatic}/sdlyfp/js/app.js"></script>
</body>
<script type="text/javascript">
$(document).ready(function() {
	// $(".tpl-left-nav-menu").find("li a").eq(2).addClass("active");
	
	var menuId = '${gtPost.menuId }';
	if(menuId)
	{
		$(".tpl-left-nav-menu").find("#"+menuId).addClass("active");
	}
	
	var message = "${message}";
	if(message)
	{
		var messageType = "${messageType}";
		msg(message,3000,messageType);
	}
});

function doSubmit()
{
	var areaCode = $("#town").val();
	if(!areaCode || 'null' == areaCode)
	{
		areaCode = $("#county").val();
	}
	if(!areaCode || 'null' == areaCode)
	{
		areaCode = $("#region").val();
	}
	if(!areaCode || 'null' == areaCode)
	{
		areaCode = '${fns:getUser().area.code}';
	}
	$("#areaCode").val(areaCode);
	document.forms[0].submit();	
}

function del(postId)
{
	var content = "您确认要删除吗？";
	var url = ctx + "/gt/gtPost/delete?id=" + postId + "&menuId=${gtPost.menuId }";
	comfirmMsg(content,url,"warning");
}

function downLoad()
{
	comfirmMsg("您将导出${fns:getUser().area.name}下的所有护林员岗位数据，若数据量较大，需要一定时间，请耐心等待，确认要导出吗？",down,"")
}
function down()
{
	$("#tip").show();
	var timeStamp = new Date().getTime();
	$("#downloadIframe").attr("src","${ctx}/gt/gtPost/downLoad?timeStamp=" + timeStamp)
	
	var interVal = setInterval(function(){
		var downToken = getCookie('downToken');
		if(downToken == timeStamp)
		{
			clearInterval(interVal);
			$("#tip").hide();
		}
	},200);	
}

</script>
<iframe id="downloadIframe" src="" style="display:none;" />
</html>